/*
MIT License

Copyright (c) 2007 Ralf Kornmann

All right reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
*/

#include "StdAfx.h"
#include "ASMInstruction.h"

OpCode RMGroup1[] =
{
	{0x0,  "ADD", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//ADD
	{0x1,  "OR", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//OR
	{0x2,  "ADC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//ADC
	{0x3,  "SBB", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SBB
	{0x4,  "AND", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//AND
	{0x5,  "SUB", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SUB
	{0x6,  "XOR", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//XOR
	{0x7,  "CMP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}//CMP
};
OpCode RMGroup2[] =
{
	{0x0,  "ROL", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//ROL
	{0x1,  "ROR", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//ROR
	{0x2,  "RCL", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//RCL
	{0x3,  "RCR", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//RCR
	{0x4,  "SHL", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SHL
	{0x5,  "SHR", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SHR
	{0x6,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x7,  "SAR", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}//SAR
};
OpCode RMGroup3[] =
{
	{0x0,  "Test", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//Test Ib
	{0x1,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x2,  "NOT", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//NOT
	{0x3,  "NEG", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//NEG
	{0x4,  "MUL", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//MUL 'AL'/'eAX'
	{0x5,  "IMUL", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//IMUL 'AL'/'eAX'
	{0x6,  "DIV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DIV 'AL'/'eAX'
	{0x7,  "IDIV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}//IDIV 'AL'/'eAX'
};
OpCode RMGroup4[] =
{
	{0x0,  "INC", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//INC Eb
	{0x1,  "DEC", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//DEC Eb
	{0x2,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x3,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x4,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x5,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x6,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x7,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}//INVALID
};
OpCode RMGroup5[] =
{
	{0x0,  "INC", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//INC Ev
	{0x1,  "DEC", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//DEC Ev
	{0x2,  "CALLN", TRUE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//CALLN Ev
	{0x3,  "CALLF", TRUE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//CALLF Ep
	{0x4,  "JMPN", TRUE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//JMPN Ev
	{0x5,  "JMPF", TRUE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//JMPF Ep
	{0x6,  "PUSH", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//PUSH Ev
	{0x7,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}//INVALID
};
OpCode RMGroup6[] =
{
	{0x0,  "SLDT", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SLDT Ew
	{0x1,  "STR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//STR Ev
	{0x2,  "LLDT", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//LLDT Ew
	{0x3,  "LTR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//LTR Ew
	{0x4,  "VERR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//VERR Ew
	{0x5,  "VERW", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//VERW Ew
	{0x6,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x7,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}//INVALID
};
OpCode RMGroup11[] =
{
	{0x0,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//MOV
	{0x1,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x2,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x3,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x4,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x5,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x6,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x7,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}//INVALID
};
OpCode RMGroup1_Eb_Ib[] =
{
	{0x0,  "ADD", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//ADD Eb,Ib
	{0x1,  "OR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//OR Eb,Ib
	{0x2,  "ADC", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//ADC Eb,Ib
	{0x3,  "SBB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//SBB Eb,Ib
	{0x4,  "AND", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//AND Eb,Ib
	{0x5,  "SUB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//SUB Eb,Ib
	{0x6,  "XOR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//XOR Eb,Ib
	{0x7,  "CMP", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL}//CMP Eb,Ib
};
OpCode RMGroup1_Ev_Iv[] =
{
	{0x0,  "ADD", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//ADD Ev,Iv
	{0x1,  "OR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//OR Ev,Iv
	{0x2,  "ADC", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//ADC Ev,Iv
	{0x3,  "SBB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//SBB Ev,Iv
	{0x4,  "AND", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//AND Ev,Iv
	{0x5,  "SUB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//SUB Ev,Iv
	{0x6,  "XOR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//XOR Ev,Iv
	{0x7,  "CMP", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL}//CMP Ev,Iv
};
OpCode RMGroup1_Ev_Ib[] =
{
	{0x0,  "ADD", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//ADD Ev,Ib
	{0x1,  "OR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//OR Ev,Ib
	{0x2,  "ADC", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//ADC Ev,Ib
	{0x3,  "SBB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//SBB Ev,Ib
	{0x4,  "AND", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//AND Ev,Ib
	{0x5,  "SUB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//SUB Ev,Ib
	{0x6,  "XOR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//XOR Ev,Ib
	{0x7,  "CMP", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL}//CMP Ev,Ib
};
OpCode RMGroup2_Eb_Ib[] =
{
	{0x0,  "ROL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//ROL Eb,Ib
	{0x1,  "ROR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//ROR Eb,Ib
	{0x2,  "RCL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//RCL Eb,Ib
	{0x3,  "RCR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//RCR Eb,Ib
	{0x4,  "SHL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//SHL Eb,Ib
	{0x5,  "SHR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//SHR Eb,Ib
	{0x6,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x7,  "SAR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL}//SAR Eb,Ib
};
OpCode RMGroup2_Ev_Iv[] =
{
	{0x0,  "ROL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//ROL Ev,Iv
	{0x1,  "ROR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//ROR Ev,Iv
	{0x2,  "RCL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//RCL Ev,Iv
	{0x3,  "RCR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//RCR Ev,Iv
	{0x4,  "SHL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//SHL Ev,Iv
	{0x5,  "SHR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//SHR Ev,Iv
	{0x6,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x7,  "SAR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL}//SAR Ev,Iv
};
OpCode RMGroup11_Eb_Ib[] =
{
	{0x0,  "MOV", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//MOV Eb,Ib
	{0x1,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x2,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x3,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x4,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x5,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x6,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x7,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}//INVALID
};
OpCode RMGroup11_Ev_Iv[] =
{
	{0x0,  "MOV", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//MOV Ev,Iv
	{0x1,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x2,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x3,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x4,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x5,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x6,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x7,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}//INVALID
};
OpCode RMGroup2_Eb[] =
{
	{0x0,  "ROL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ROL Eb,'1'
	{0x1,  "ROR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ROR Eb,'1'
	{0x2,  "RCL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//RCL Eb,'1'
	{0x3,  "RCR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//RCR Eb,'1'
	{0x4,  "SHL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SHL Eb,'1'
	{0x5,  "SHR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SHR Eb,'1'
	{0x6,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x7,  "SAR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL}//SAR Eb,'1'
};
OpCode RMGroup2_Ev[] =
{
	{0x0,  "ROL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ROL Ev,'1'
	{0x1,  "ROR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ROR Ev,'1'
	{0x2,  "RCL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//RCL Ev,'1'
	{0x3,  "RCR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//RCR Ev,'1'
	{0x4,  "SHL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SHL Ev,'1'
	{0x5,  "SHR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SHR Ev,'1'
	{0x6,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x7,  "SAR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL}//SAR Ev,'1'
};
OpCode RMGroup3_Eb[] =
{
	{0x0,  "Test", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//Test Ib
	{0x1,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x2,  "NOT", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//NOT Eb
	{0x3,  "NEG", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//NEG Eb
	{0x4,  "MUL", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//MUL 'AL'/'eAX'
	{0x5,  "IMUL", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//IMUL 'AL'/'eAX'
	{0x6,  "DIV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DIV 'AL'/'eAX'
	{0x7,  "IDIV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}//IDIV 'AL'/'eAX'
};
OpCode RMGroup3_Ev[] =
{
	{0x0,  "Test", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//Test Ib
	{0x1,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INVALID
	{0x2,  "NOT", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//NOT Ev
	{0x3,  "NEG", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//NEG Ev
	{0x4,  "MUL", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//MUL 'AL'/'eAX'
	{0x5,  "IMUL", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//IMUL 'AL'/'eAX'
	{0x6,  "DIV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DIV 'AL'/'eAX'
	{0x7,  "IDIV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}//IDIV 'AL'/'eAX'
};

OpCode OpCodes2BYTE[] =
{
  {0x0,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}
};

OpCode OpCodesCopro[] =
{
  {0x0,  "INVALID", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL}
};

OpCode OpCodes1BYTE[] =
{
	{0x0,  "ADD", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ADD Eb,Gb
	{0x1,  "ADD", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ADD Ev,Gv
	{0x2,  "ADD", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ADD Gb,Eb
	{0x3,  "ADD", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ADD Gv,Ev
	{0x4,  "ADD", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//ADD 'AL',Ib
	{0x5,  "ADD", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//ADD 'eAX', Iv
	{0x6,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'ES'
	{0x7,  "POP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POP 'ES'
	{0x8,  "OR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//OR Eb,Gb
	{0x9,  "OR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//OR Ev,Gv
	{0xA,  "OR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//OR Gb,Eb
	{0xB,  "OR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//OR Gv,Ev
	{0xC,  "OR", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//OR 'AL',Ib
	{0xD,  "OR", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//OR 'eAX',Iv
	{0xE,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'CS'
	{0xF,  "ESCAPE", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,OpCodes2BYTE,NULL},//ESCAPE 2BYTE
	{0x10,  "ADC", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ADC Eb,Gb
	{0x11,  "ADC", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ADC Ev,Gv
	{0x12,  "ADC", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ADC Gb,Eb
	{0x13,  "ADC", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ADC Gv,Ev
	{0x14,  "ADC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//ADC 'AL',Ib
	{0x15,  "ADC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//ADC 'eAX', Iv
	{0x16,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'SS'
	{0x17,  "POP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POP 'SS'
	{0x18,  "SBB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SBB Eb,Gb
	{0x19,  "SBB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SBB Ev,Gv
	{0x1A,  "SBB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SBB Gb,Eb
	{0x1B,  "SBB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SBB Gv,Ev
	{0x1C,  "SBB", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//SBB 'AL',Ib
	{0x1D,  "SBB", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//SBB 'eAX',Iv
	{0x1E,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'DS'
	{0x1F,  "POP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POP 'DS'
	{0x20,  "AND", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//AND Eb,Gb
	{0x21,  "AND", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//AND Ev,Gv
	{0x22,  "AND", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//AND Gb,Eb
	{0x23,  "AND", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//AND Gv,Ev
	{0x24,  "AND", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//AND 'AL',Ib
	{0x25,  "AND", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//AND 'eAX', Iv
	{0x26,  "SEG=ES", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SEG=ES Prefix,1
	{0x27,  "DAA", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DAA
	{0x28,  "SUB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SUB Eb,Gb
	{0x29,  "SUB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SUB Ev,Gv
	{0x2A,  "SUB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SUB Gb,Eb
	{0x2B,  "SUB", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//SUB Gv,Ev
	{0x2C,  "SUB", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//SUB 'AL',Ib
	{0x2D,  "SUB", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//SUB 'eAX',Iv
	{0x2E,  "SEG=CS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SEG=CS Prefix,1
	{0x2F,  "DAS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DAS
	{0x30,  "XOR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//XOR Eb,Gb
	{0x31,  "XOR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//XOR Ev,Gv
	{0x32,  "XOR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//XOR Gb,Eb
	{0x33,  "XOR", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//XOR Gv,Ev
	{0x34,  "XOR", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//XOR 'AL',Ib
	{0x35,  "XOR", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//XOR 'eAX', Iv
	{0x36,  "SEG=SS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SEG=SS Prefix,1
	{0x37,  "AAA", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//AAA
	{0x38,  "CMP", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//CMP Eb,Gb
	{0x39,  "CMP", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//CMP Ev,Gv
	{0x3A,  "CMP", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//CMP Gb,Eb
	{0x3B,  "CMP", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//CMP Gv,Ev
	{0x3C,  "CMP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//CMP 'AL',Ib
	{0x3D,  "CMP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//CMP 'eAX',Iv
	{0x3E,  "SEG=DS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SEG=DS Prefix,1
	{0x3F,  "AAS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//AAS
	{0x40,  "INC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INC 'eAX'
	{0x41,  "INC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INC 'eCX'
	{0x42,  "INC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INC 'eDX'
	{0x43,  "INC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INC 'eBX'
	{0x44,  "INC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INC 'eSP'
	{0x45,  "INC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INC 'eBP'
	{0x46,  "INC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INC 'eSI'
	{0x47,  "INC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INC 'eDI'
	{0x48,  "DEC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DEC 'eAX'
	{0x49,  "DEC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DEC 'eCX'
	{0x4A,  "DEC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DEC 'eDX'
	{0x4B,  "DEC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DEC 'eBX'
	{0x4C,  "DEC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DEC 'eSP'
	{0x4D,  "DEC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DEC 'eBP'
	{0x4E,  "DEC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DEC 'eSI'
	{0x4F,  "DEC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//DEC 'eDI'
	{0x50,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'eAX'
	{0x51,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'eCX'
	{0x52,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'eDX'
	{0x53,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'eBX'
	{0x54,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'eSP'
	{0x55,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'eBP'
	{0x56,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'eSI'
	{0x57,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSH 'eDI'
	{0x58,  "POP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POP 'eAX'
	{0x59,  "POP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POP 'eCX'
	{0x5A,  "POP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POP 'eDX'
	{0x5B,  "POP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POP 'eBX'
	{0x5C,  "POP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POP 'eSP'
	{0x5D,  "POP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POP 'eBP'
	{0x5E,  "POP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POP 'eSI'
	{0x5F,  "POP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POP 'eDI'
	{0x60,  "PUSHA", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSHA
	{0x61,  "POPA", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POPA
	{0x62,  "BOUND", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//BOUND Gv,Ma
	{0x63,  "ARPL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//ARPL Ew,Gw
	{0x64,  "SEG=FS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SEG=FS Prefix,1
	{0x65,  "SEG=GS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SEG=GS Prefix,1
	{0x66,  "OpdSize", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//OpdSize Prefix,3
	{0x67,  "AddrSize", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//AddrSize Prefix,4
	{0x68,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//PUSH Iv
	{0x69,  "IMUL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_OpSize,0,NULL,NULL},//IMUL Gv,Ev,Iv
	{0x6A,  "PUSH", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//PUSH Ib
	{0x6B,  "IMUL", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_Fix1,0,NULL,NULL},//IMUL Gv,Ev,Ib
	{0x6C,  "INS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INS Yb,'DX'
	{0x6D,  "INS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INS Yv,'DX'
	{0x6E,  "OUTS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//OUTS 'DX',Xb
	{0x6F,  "OUTS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//OUTS 'DX',Xv
	{0x70,  "JO", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JO Jb
	{0x71,  "JNO", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JNO Jb
	{0x72,  "JB", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JB Jb
	{0x73,  "JNB", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JNB Jb
	{0x74,  "JZ", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JZ Jb
	{0x75,  "JNZ", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JNZ Jb
	{0x76,  "JBE", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JBE Jb
	{0x77,  "JNBE", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JNBE Jb
	{0x78,  "JS", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JS Jb
	{0x79,  "JNS", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JNS Jb
	{0x7A,  "JP", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JP Jb
	{0x7B,  "JNP", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JNP Jb
	{0x7C,  "JL", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JL Jb
	{0x7D,  "JNL", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JNL Jb
	{0x7E,  "JLE", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JLE Jb
	{0x7F,  "JNLE", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JNLE Jb
	{0x80,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup1_Eb_Ib},//GROUP 1_Eb_Ib
	{0x81,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup1_Ev_Iv},//GROUP 1_Ev_Iv
	{0x82,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup1_Eb_Ib},//GROUP 1_Eb_Ib
	{0x83,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup1_Ev_Ib},//GROUP 1_Ev_Ib
	{0x84,  "TEST", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//TEST Eb,Gb
	{0x85,  "TEST", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//TEST Ev,Gv
	{0x86,  "XCHG", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//XCHG Eb,Gb
	{0x87,  "XCHG", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//XCHG Ev,Gv
	{0x88,  "MOV", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//MOV Eb,Gb
	{0x89,  "MOV", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//MOV Ev,Gv
	{0x8A,  "MOV", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//MOV Gb,Eb
	{0x8B,  "MOV", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//MOV Gv,Ev
	{0x8C,  "MOV", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//MOV Ew,Sw
	{0x8D,  "LEA", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//LEA Gv,M
	{0x8E,  "MOV", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//MOV Sw,Ew
	{0x8F,  "POP", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//POP Ev
	{0x90,  "NOP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//NOP
	{0x91,  "XCHG", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//XCHG 'eAX','eCX'
	{0x92,  "XCHG", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//XCHG 'eAX','eDX'
	{0x93,  "XCHG", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//XCHG 'eAX','eBX'
	{0x94,  "XCHG", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//XCHG 'eAX','eSP'
	{0x95,  "XCHG", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//XCHG 'eAX','eBP'
	{0x96,  "XCHG", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//XCHG 'eAX','eSI'
	{0x97,  "XCHG", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//XCHG 'eAX','eDI'
	{0x98,  "CBW", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//CBW
	{0x99,  "CWD", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//CWD
	{0x9A,  "CALLF", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Addr,0,NULL,NULL},//CALLF Ap
	{0x9B,  "FWAIT", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//FWAIT
	{0x9C,  "PUSHF", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//PUSHF Fv
	{0x9D,  "POPF", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//POPF Fv
	{0x9E,  "SAHF", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SAHF
	{0x9F,  "LAHF", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//LAHF
	{0xA0,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_AddrSize,0,NULL,NULL},//MOV 'AL',Ob
	{0xA1,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_AddrSize,0,NULL,NULL},//MOV 'eAX', Ov
	{0xA2,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_AddrSize,0,NULL,NULL},//MOV Ob, 'AL'
	{0xA3,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_AddrSize,0,NULL,NULL},//MOV Ov, 'eAX'
	{0xA4,  "MOVS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//MOVS Yb,Xb
	{0xA5,  "MOVS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//MOVS Yv,Xv
	{0xA6,  "CMPS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//CMPS Yb,Xb
	{0xA7,  "CMPS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//CMPS Xv,Yv
	{0xA8,  "TEST", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//TEST 'AL',Ib
	{0xA9,  "TEST", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//TEST 'eAX', Iv
	{0xAA,  "STOS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//STOS Yb,'AL'
	{0xAB,  "STOS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//STOS Yv,'eAX'
	{0xAC,  "LODS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//LODS 'AL',Xb
	{0xAD,  "LODS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//LODS 'eAX',Xv
	{0xAE,  "SCAS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SCAS 'AL',Yb
	{0xAF,  "SCAS", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SCAS 'eAX', Yv
	{0xB0,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//MOV 'AL',Lb
	{0xB1,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//MOV 'CL',Lb
	{0xB2,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//MOV 'DL',Lb
	{0xB3,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//MOV 'BL',Lb
	{0xB4,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//MOV 'AH',Lb
	{0xB5,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//MOV 'CH',Lb
	{0xB6,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//MOV 'DH',Lb
	{0xB7,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//MOV 'BH',Lb
	{0xB8,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//MOV 'eAX',Lv
	{0xB9,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//MOV 'eCX',Lv
	{0xBA,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//MOV 'eDX',Lv
	{0xBB,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//MOV 'eBX',Lv
	{0xBC,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//MOV 'eSP',Lv
	{0xBD,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//MOV 'eBP',Lv
	{0xBE,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//MOV 'eSI',Lv
	{0xBF,  "MOV", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//MOV 'eDI',Lv
	{0xC0,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup2_Eb_Ib},//GROUP 2_Eb_Ib
	{0xC1,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup2_Ev_Iv},//GROUP 2_Ev_Iv
	{0xC2,  "RET", TRUE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix2,0,NULL,NULL},//RET Iw
	{0xC3,  "RET", TRUE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//RET
	{0xC4,  "LES", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//LES Gv,Mp
	{0xC5,  "LDS", FALSE, FALSE,RMT_BYTE, SIBT_Check, DT_Check, IT_No,0,NULL,NULL},//LDS Gv,Mp
	{0xC6,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup11_Eb_Ib},//GROUP 11_Eb_Ib
	{0xC7,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup11_Ev_Iv},//GROUP 11_Ev_Iv
	{0xC8,  "ENTER", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix3,0,NULL,NULL},//ENTER Iw,Ib
	{0xC9,  "LEAVE", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//LEAVE
	{0xCA,  "RETF", TRUE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix2,0,NULL,NULL},//RETF Iw
	{0xCB,  "RETF", TRUE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//RETF
	{0xCC,  "INT3", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INT3
	{0xCD,  "INT", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//INT Ib
	{0xCE,  "INTO", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INTO
	{0xCF,  "IRET", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//IRET
	{0xD0,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup2_Eb},//GROUP 2_Eb_'1'
	{0xD1,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup2_Ev},//GROUP 2_Ev_'1'
	{0xD2,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup2_Eb},//GROUP 2_Eb_'CL'
	{0xD3,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup2_Ev},//GROUP 2_Ev_'CL'
	{0xD4,  "AAM", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//AAM Ib
	{0xD5,  "AAD", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//AAD Ib
	{0xD6,  "SALC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//SALC
	{0xD7,  "XLAT", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//XLAT
	{0xD8,  "ESCAPE", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,OpCodesCopro,NULL},//ESCAPE Copro 
	{0xD9,  "ESCAPE", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,OpCodesCopro,NULL},//ESCAPE Copro
	{0xDA,  "ESCAPE", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,OpCodesCopro,NULL},//ESCAPE Copro
	{0xDB,  "ESCAPE", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,OpCodesCopro,NULL},//ESCAPE Copro
	{0xDC,  "ESCAPE", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,OpCodesCopro,NULL},//ESCAPE Copro
	{0xDD,  "ESCAPE", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,OpCodesCopro,NULL},//ESCAPE Copro
	{0xDE,  "ESCAPE", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,OpCodesCopro,NULL},//ESCAPE Copro
	{0xDF,  "ESCAPE", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,OpCodesCopro,NULL},//ESCAPE Copro
	{0xE0,  "LOOPNE", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//LOOPNE Jb
	{0xE1,  "LOOPE", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//LOOPE Jb
	{0xE2,  "LOOP", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//LOOP Jb
	{0xE3,  "JCXZ", FALSE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JCXZ Jb
	{0xE4,  "IN", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//IN 'AL',Ib
	{0xE5,  "IN", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//IN 'eAX',Ib
	{0xE6,  "OUT", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//OUT Ib,'AL'
	{0xE7,  "OUT", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//OUT Ib,'eAX'
	{0xE8,  "CALL", TRUE, TRUE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//CALL Jv
	{0xE9,  "JMP", TRUE, TRUE,RMT_No, SIBT_No, DT_No, IT_OpSize,0,NULL,NULL},//JMP Jv
	{0xEA,  "JMP", TRUE, FALSE,RMT_No, SIBT_No, DT_No, IT_Addr,0,NULL,NULL},//JMP Ap
	{0xEB,  "JMP", TRUE, TRUE,RMT_No, SIBT_No, DT_No, IT_Fix1,0,NULL,NULL},//JMP Jb
	{0xEC,  "IN", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//IN 'AL','DX'
	{0xED,  "IN", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//IN 'eAX','DX'
	{0xEE,  "OUT", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//OUT 'DX','AL'
	{0xEF,  "OUT", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//OUT 'DX', 'eAX'
	{0xF0,  "LOCK", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//LOCK Prefix,2
	{0xF1,  "INT1", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//INT1
	{0xF2,  "REPNE", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//REPNE Prefix,2
	{0xF3,  "REP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//REP Prefix,2
	{0xF4,  "HLT", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//HLT
	{0xF5,  "CMC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//CMC
	{0xF6,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup3_Eb},//GROUP 3_Eb
	{0xF7,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup3_Ev},//GROUP 3_Ev
	{0xF8,  "CLC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//CLC
	{0xF9,  "STC", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//STC
	{0xFA,  "CLI", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//CLI
	{0xFB,  "STI", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//STI
	{0xFC,  "CLD", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//CLD
	{0xFD,  "STD", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,NULL},//STD
	{0xFE,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup4},//GROUP 4
	{0xFF,  "GROUP", FALSE, FALSE,RMT_No, SIBT_No, DT_No, IT_No,0,NULL,RMGroup5}//GROUP 5
};

CASMInstruction::CASMInstruction ()
{
    m_DefaultAddrMode = 32;
    m_AlternatAddrMode = 16;
    m_DefaultOpcodeSize = 32;
    m_AlternatOpCodeSize = 16;
}

bool CASMInstruction::Parse (BYTE* pInst)
{
  Reset ();

  while (OpCodes1BYTE[pInst[m_Size]].m_PrefixGroup != 0)
  {
    m_pPrefix[OpCodes1BYTE[pInst[m_Size]].m_PrefixGroup-1] = &OpCodes1BYTE[pInst[m_Size]];
    m_Size++;
  }

  m_OpCode1 = &OpCodes1BYTE[pInst[m_Size]];
  m_Size++;

  if (m_OpCode1->m_pEscape != NULL)
  {
//    LogMessage (ML_Alarm, "Parser 2 Byte");

    m_Size++;

    return false;
  }
  else
    m_LastOpCode = m_OpCode1;

  if (m_LastOpCode->m_pRMEscape != NULL)
  {
    int SubID = (pInst[m_Size] >> 3) & 0x7;
    m_RMOpCode = &m_OpCode1->m_pRMEscape[SubID];
    m_LastOpCode = m_RMOpCode;
  }

  switch (m_LastOpCode->m_RMType)
  {
    case RMT_No:
      break;

    case RMT_Register:
      ReadRMRegister (pInst[m_Size]);
      m_Size++;
      break;

    case RMT_BYTE:
      ReadRMByte (pInst[m_Size]);
      m_Size++;
      break;
  }

  switch (m_LastOpCode->m_SIBType)
  {
    case SIBT_No:
      break;

    case SIBT_BYTE:
      ReadSIB (pInst[m_Size]);
      m_Size++;
      break;

    case SIBT_Check:
      if (CheckSIB ())
      {
        ReadSIB (pInst[m_Size]);
        m_Size++;
      }
      break;
  }

  switch (m_LastOpCode->m_DispType)
  {
    case DT_No:
      break;

    case DT_Check:
      m_DisplacementSize = CheckDisp ();
      break;
  }

  if (m_DisplacementSize > 0)
  {
    memcpy (&m_Displacement, &pInst[m_Size], m_DisplacementSize);
    m_Size += m_DisplacementSize;
  }

  switch (m_LastOpCode->m_IType)
  {
    case IT_No:
      break;

    case IT_Fix1:
      m_ImmediateSize = 1;
      break;

    case IT_Fix2:
      m_ImmediateSize = 2;
      break;

    case IT_Fix3:
      m_ImmediateSize = 3;
      break;

    case IT_Fix4:
      m_ImmediateSize = 4;
      break;

    case IT_OpSize:
      m_ImmediateSize = GetOpcodeSize() / 8;
      break;

    case IT_Addr:
      m_ImmediateSize = 4;

    case IT_AddrSize:
      m_ImmediateSize = GetAddressMode() / 8;
      break;
  }

  if (m_ImmediateSize > 0)
  {
    memcpy (&m_Immediate, &pInst[m_Size], m_ImmediateSize);
    m_Size += m_ImmediateSize;
  }

  return true;
}

bool CASMInstruction::Transfer (BYTE* pSource, BYTE* pDest)
{
//  LogMessage (ML_Debug, "ASM:%s", m_LastOpCode->m_Name);

  memcpy (pDest, pSource, m_Size);

  if (!m_LastOpCode->m_RelJump)
    return true;

//  LogMessage (ML_Warning, "Detected Jump");

  if (GetJumpPatchSize() == 0)
  {
//    LogMessage (ML_Warning, "Far Jump Patched");

    DWORD InstOffset = m_Size - 4;

    int Offset = *(int*)&pSource[InstOffset];
    *(int*)&pDest[InstOffset] = Offset - (pDest - pSource);

    return true;
  }

  switch (m_OpCode1->m_Code)
  {
    case 0xEB:
      return TransferEB (pSource, pDest);

    default:
//      LogMessage (ML_Warning, "Can Not Patch Jump (%x)", m_OpCode1->m_Code);
		break;
  }

  return false;
}

bool  CASMInstruction::TransferEB (BYTE* pSource, BYTE* pDest)
{
//  LogMessage (ML_Warning, "Near Jump Patched");

  int Offset = *(signed char*)&pSource[1];
  pDest[0] = 0xE9;
  *(int*)&pDest[1] = Offset - (pDest - pSource);

  return true;
}

DWORD CASMInstruction::GetSize ()
{
  return m_Size;
}

DWORD CASMInstruction::GetImmediateSize ()
{
  return m_ImmediateSize;
}

DWORD CASMInstruction::GetJumpPatchSize ()
{
  if (!IsRelJump())
    return 0;

  int OffsetSize = 4-GetImmediateSize();

  if (OffsetSize == 0)
    return 0;

  // TODOCheck

  return OffsetSize;
}

bool CASMInstruction::IsStop ()
{
  if (m_LastOpCode == NULL)
    return true;

  return (m_LastOpCode->m_Stop == TRUE);
}

bool CASMInstruction::IsRelJump ()
{
  if (m_LastOpCode == NULL)
    return false;

  return (m_LastOpCode->m_RelJump == TRUE);
}


void CASMInstruction::Reset ()
{
  m_pPrefix[0] = NULL;
  m_pPrefix[1] = NULL;
  m_pPrefix[2] = NULL;
  m_pPrefix[3] = NULL;

  m_OpCode1 = NULL;
  m_OpCode2 = NULL;
  m_RMOpCode = NULL;

  m_LastOpCode = NULL;

  m_Mod = -1;
  m_Reg = -1;
  m_RM = -1; 

  m_Scale = -1;
  m_Index = -1;
  m_Base = -1;

  m_DisplacementSize = 0;
  m_Displacement = 0;

  m_ImmediateSize = 0;
  m_Immediate = 0;

  m_Size = 0;
}

void CASMInstruction::ReadRMRegister (BYTE rm)
{
  m_Reg = (rm >> 3) & 0x7;
}

void CASMInstruction::ReadRMByte (BYTE rm)
{
  ReadRMRegister (rm);

  m_Mod = (rm >> 6) & 0x3;
  m_RM = rm & 0x7;
}

void CASMInstruction::ReadSIB (BYTE SIB)
{
  m_Scale = (SIB >> 6) & 0x3;
  m_Index = (SIB >> 3) & 0x7;
  m_Base = SIB & 0x7;
}

bool CASMInstruction::CheckSIB ()
{
  switch (GetAddressMode())
  {
    case 16: return CheckSIB16 ();
    case 32: return CheckSIB32 ();
  }

  return false;
}

bool CASMInstruction::CheckSIB16 ()
{
  return false;
}

bool CASMInstruction::CheckSIB32 ()
{
  if (m_Mod == -1 || m_RM == -1)
    return false;

  switch (m_Mod)
  {
    case 0:
    case 1:
    case 2:
      return (m_RM == 0x4);
  }

  return false;
}

int CASMInstruction::CheckDisp ()
{
  switch (GetAddressMode())
  {
    case 16: return CheckDisp16 ();
    case 32: return CheckDisp32 ();
  }

  return 0;
}

int CASMInstruction::CheckDisp16 ()
{
  switch (m_Mod)
  {
    case 0:
      if (m_RM == 6)
        return 2;

      return 0;

    case 1:
      return 1;

    case 2:
      return 2;
  }

  return 0;
}

int CASMInstruction::CheckDisp32 ()
{
  switch (m_Mod)
  {
    case 0:
      if (m_RM == 5)
        return 4;

      if (m_Base == 5)
        return 4;

      return 0;

    case 1:
      return 1;

    case 2:
      return 4;
  }

  return 0;
}


int CASMInstruction::GetAddressMode ()
{
  if (m_pPrefix[3] != NULL)
    return m_AlternatAddrMode;

  return m_DefaultAddrMode;
}

int CASMInstruction::GetOpcodeSize ()
{
  if (m_pPrefix[2] != NULL)
    return m_AlternatOpCodeSize;

  return m_DefaultOpcodeSize;
}
